﻿using Microsoft.Xna.Framework;

namespace SomeGame.Actors.Components.Movement {

    public class PlayerMovement : ActorComponent {

		public const float WALKING_SPEED = 30;
		public float CurrentSpeed; // Pixels per second.
        public float Speed; // Pixels per second.
        public float Acceleration;
        private Vector2 direction;
        private Body Body;

        public PlayerMovement(Body body, float speed) {
            Speed = speed;
            Body = body;
        }

        public Vector2 Direction {
            get { return direction; }
            set { direction = value != Vector2.Zero ? Vector2.Normalize(value) : value; }
        }

	    public override void Update(GameTime gameTime, bool parallax) {
            Body.Position += Direction * (float)(Speed * gameTime.ElapsedGameTime.TotalSeconds);
	    }

    }

}